﻿using System;
using System.Threading;
using UniRx.InternalUtil;

namespace UniRx.Operators
{
	// Token: 0x020002CC RID: 716
	public abstract class OperatorObserverBase<TSource, TResult> : IDisposable, IObserver<TSource>
	{
		// Token: 0x06000F6B RID: 3947 RVA: 0x0003F5B1 File Offset: 0x0003D9B1
		public OperatorObserverBase(IObserver<TResult> observer, IDisposable cancel)
		{
			this.observer = observer;
			this.cancel = cancel;
		}

		// Token: 0x06000F6C RID: 3948
		public abstract void OnNext(TSource value);

		// Token: 0x06000F6D RID: 3949
		public abstract void OnError(Exception error);

		// Token: 0x06000F6E RID: 3950
		public abstract void OnCompleted();

		// Token: 0x06000F6F RID: 3951 RVA: 0x0003F5CC File Offset: 0x0003D9CC
		public void Dispose()
		{
			this.observer = EmptyObserver<TResult>.Instance;
			IDisposable disposable = Interlocked.Exchange<IDisposable>(ref this.cancel, null);
			if (disposable != null)
			{
				disposable.Dispose();
			}
		}

		// Token: 0x040008F8 RID: 2296
		protected internal volatile IObserver<TResult> observer;

		// Token: 0x040008F9 RID: 2297
		private IDisposable cancel;
	}
}
